package com.x.wx.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.x.framework.exception.BusinessException;
import com.x.framework.exception.ExceptionCode;
import com.x.framework.service.BaseService;
import com.x.wx.dao.WxMenuDao;
import com.x.wx.model.WxMenu;
import com.x.wx.rpc.WxMenuRpcService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by Administrator on 2018/1/8.
 */
//@Service
@Component
@Service(interfaceName = "com.x.wx.rpc.WxMenuRpcService", timeout = 10000)
public class WxMenuService extends BaseService implements WxMenuRpcService {

    @Autowired
    private WxMenuDao wxMenuDao;//车辆配置关系DAO

    public List<WxMenu> selectWxMenuList(WxMenu wxMenu) {
        try {
            return  wxMenuDao.selectWxMenuList(wxMenu);
        } catch (Exception e) {
            throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
        }
    }


    public WxMenu insertWxMenu(WxMenu wxMenu) {
        try {
            return this.insert(wxMenu);
        } catch (Exception e) {
            throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
        }
    }

    public int updateWxMenu(WxMenu wxMenu) {
        try {
            return this.update(wxMenu);
        } catch (Exception e) {
            throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
        }
    }

    public int  deleteWxMenu(WxMenu wxMenu) {
        try {
            return this.delete(wxMenu);
        } catch (Exception e) {
            throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
        }
    }


}
